@extends('home.layout.base')
@section('title', Session::get('userData')->user_nickname . '的个人中心')
@section('pluginstyle')
<link rel="stylesheet" href="{{ asset('/dist/home/css/qikoo_user.css') }}">
<link rel="stylesheet" href="{{ asset('/common/css/common.css') }}">
@endsection
@section('content')
<div class="user-body"> 
    <div class="user-container"> 
        <div class="user-crumbs m-b-10">
            <a href="{{ url('/user') }}">首页</a> &gt; 我的喜欢
        </div> 
        <div class="clearfix_new"> 
            @include('home.user.menu')
            <div class="user-main"> 
                <div class="favorite_container clearfix_new"> 
                    <h1 class="favorite_title"> 我的喜欢 </h1>
                    @if(!$favorites->all())
                    <div class="no_like"> 
                        <img src="{{ asset('/common/images/nolike.png') }}" /> 
                        <p class="no_like_txt">您暂未收藏任何商品</p>
                    </div>
                    @else
                    <ul class="favorite_list clearfix_new">
                        @foreach($favorites as $fav)
                        <li class="favorite_item"> 
                            <div class="favorite_item_img"> 
                                <img src="{{ asset($fav->goodsInfo->goods_thumb) }}" /> 
                                @if(!$fav->goodsInfo->goods_num)
                                <p class="outbox selout"> 售罄 </p> 
                                @elseif($fav->goodsInfo->goods_status != 1)
                                <p class="outbox useout"> 失效 </p> 
                                @endif
                                <p class="favorite_cheaper" style="visibility:hidden"> </p> 
                            </div>
                            <p class="favorite_item_name" title="{{ $fav->goodsInfo->goods_name }}">{{ $fav->goodsInfo->goods_name }}</p>
                            <p class="favorite_itme_price">&yen;{{ $fav->goodsInfo->goods_price }}</p> 
                            <div class="favorite_item_btn_box"> 
                                <span class="favorite_cancelbtn" data-id="{{ $fav->id }}"> 取消 </span> 
                                <!--<span class="favorite_addbtn"> 加入购物车 </span>--> 
                            </div>
                        </li>
                        @endforeach
                    </ul>
                    <div class="favorite_page_wrap"> 
                        <div class="favorite_page_index clearfix_new"> 
                            {!! $favorites->render() !!}
                        </div>
                    </div>
                    @endif 
                </div> 
            </div> 
        </div> 
    </div> 
</div>
@endsection
@section('pluginscript')
<script type="text/javascript">
$(function(){
   $('.favorite_item').mouseenter(function(){
       $('.favorite_item_btn_box').css('visibility', 'hidden');
       $(this).find('.favorite_item_btn_box').css('visibility','visible');
   });
   $('.favorite_item').mouseleave(function(){
       $(this).find('.favorite_item_btn_box').css('visibility','hidden');
   });
   
   $('.favorite_cancelbtn').click(function(){
       var li = $(this).parents('.favorite_item');
       var id = $(this).attr('data-id');
       $.get('{{ url("/user/favorite/cancel") }}', {id:id}, function(msg){
           if(msg.status == 1){
               li.remove();
           } else {
               qikoo.dialog.alert('取消失败');
           }
       });
   });
});
</script>
@endsection